<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<%@ page import="org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter" %>
<%@ page import="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter" %>
<%@ page import="org.springframework.security.web.WebAttributes" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>巨人网盘</title>
<%@ include file="/common/meta.jsp" %>
<link rel="stylesheet" href="${ctx}/css/common.css" />
<link rel="stylesheet" href="${ctx}/css/sindex.css" />

</head>
<body>
	<%
		if (session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION) != null) {
	%> 
	<div class="error"> 登录失败，请重试. 
	       <%
	           out.print(session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION));
	           session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
	       %>
	</div>
	<%
		}
	%>

<div class="top">
    <div class="top_con">
    
    <form id="loginForm" action="${ctx}/j_security_check" method="post" style="margin-top:1em">
        <div class="top_fm">
            <input class="top_inp" type="text" id='j_username' name='j_username'  
                       <s:if test="not empty param.error">
						value='<%=session.getAttribute(UsernamePasswordAuthenticationFilter.SPRING_SECURITY_LAST_USERNAME_KEY)%>'
					   </s:if>
				tips="邮箱"/>
            <input class="top_inp" type="password" id='j_password' name='j_password'/>
            <button class="login_btn" onclick="javascript:L();return false;">登录</button>
            <div class="info"> <span class="info_span">
                <label>
                <input type="checkbox" name="_spring_security_remember_me">
                记住我</label>
                </span><span class="info_span"><a href="#">忘记密码？</a></span> </div>
        </div>
   </form>     
  
  <form action="${ctx}/register.action" method="post" style="margin-top:1em">
        <div class="reg">
            <ul>
                <li>
                    <input type="text" name="user.loginName" id="user.loginName" tips="用户名"/>
                </li>
                <li>
                   <!-- <input type="text" tips="密码">  --> 
                    <input type="password"  name="user.password" id="user.password"/>
                </li>
                <li>
                    <input type="text" name="user.email" id="user.email" tips="邮箱"/>
                </li>
                <li class="last">
                    <button class="reg_btn" type="submit">注册</button>
                </li>
            </ul>
        </div>
</form>
        
    </div>
</div>
<div class="mid">
    <ul class="mid_sl">
        <li class="l1">安全稳定</li>
        <li class="l2">文件同步</li>
        <li class="l3">数据备份</li>
        <li class="l4">超大容量</li>
    </ul>
</div>
<div class="bottom">
    <div class="footer">
        <div class="vice_nav"><a href="#">关于巨盘</a> · <a href="#">加入我们</a> · <a href="#">联系我们</a> · <a href="#">帮助中心</a> · <a href="#">在线反馈</a></div>
        COPYRIGHT @ 2011 GIANT. ALL RIGHTS RESERVED. 巨人网络 版权所有</div>
</div>

<script src="${ctx}/js/jquery-1.7.0.min.js"></script>
<script src="${ctx}/js/common.js"></script>
<script type="text/javascript">
function L()
{
  $.getJSON("${ctx}/login!domainLogin.action",{userName:$("#j_username").val(),passwd:$("#j_password").val()},
	      function(response)
	      {
		     if(!response||!response.code)
		     {
		    	alert("no data"); return; 
		     }
		     if(response.code!=200)
	    	 {
	    	    alert(response.message); return ;
	    	 }
		     $("#loginForm").submit();
	      }
  );	
}
</script>

</body>
</html>
